function MoveTo(float X, float Z, float Distance)
{
	declare stuck uint local 0
	MadePosition:Set[FALSE]
	if ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} > ${Distance} && ${VirtualState.Equal[IDLE]}
	{
		EA "Moving Toward" "${X} ${Z}"
		call Face ${X} ${Z}
		press "${MOVEFORWARD}"
		while ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} > ${Distance} && ${VirtualState.Equal[IDLE]} && ${stuck} <= 2
		{
			call Face ${X} ${Z}
			if ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} > 20
			{
				call RandomShuffle
			}
			MoveX:Set[${Me.X}]
			MoveZ:Set[${Me.Z}]
			wait 5

			call CheckObstacle
			if ${Return}
			{
				stuck:Inc
				wait ${Math.Rand[1]:Inc[5]}
				call Face ${X} ${Z}
				call CheckObstacle ${X} ${Z}
			}
		}
		call StopMoving
		call Face ${X} ${Z}
		MoveX:Set[0]
		MoveZ:Set[0]
		if ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} <= ${Distance}
		{
			MadePosition:Set[TRUE]
		}
		EA "Stopping @ ${Distance}" "${X} ${Z}"
		wait 5
	}
}
function MoveFrom(float X, float Z, float Distance)
{
	declare stuck uint local 0
	if ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} < ${Distance} && ${VirtualState.Equal[IDLE]}
	{
		EA "Moving Toward" "${X} ${Z}"
		call Face ${X} ${Z}
		press -hold ${MOVEBACKWARD}
		while ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} < ${Distance} && ${VirtualState.Equal[IDLE]} && ${stuck} <= 2
		{
			call Face ${X} ${Z}
			if ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} > 20
			{
				call RandomShuffle
			}
			MoveX:Set[${Me.X}]
			MoveZ:Set[${Me.Z}]
			wait 5
			
			call CheckObstacle
			if ${Return}
			{
				stuck:Inc
				wait ${Math.Rand[1]:Inc[5]}
				call Face ${X} ${Z}
				call CheckObstacle ${X} ${Z}
			}
		}
		call StopMoving
		call Face ${X} ${Z}
		MoveX:Set[0]
		MoveZ:Set[0]
		EA "Stopping @ ${Distance}" "${X} ${Z}"
		wait 5
	}
}
function MoveToRanged(float X, float Z)
{
	call MoveTo ${X} ${Z} 30.000000
}
function MoveToMidRanged(float X, float Z)
{
	call MoveTo ${X} ${Z} 25.000000
}
function MoveToMelee(float X, float Z)
{
	call MoveTo ${X} ${Z} 5.000000
}
function MoveFromRanged(float X, float Z)
{
	call MoveFrom ${X} ${Z} 30.000000
}
function MoveFromMidRanged(float X, float Z)
{
	call MoveFrom ${X} ${Z} 25.000000
}
function MoveFromMelee(float X, float Z)
{
	call MoveFrom ${X} ${Z} 5.000000
}